package com.example.aop.service.impl;

import com.example.aop.service.OrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;


@Service
public class OrderServiceImpl implements OrderService {

    private static final Logger logger = LoggerFactory.getLogger(OrderServiceImpl.class);

    @Override
    public Boolean add(String orderNum) {
        logger.info("新增订单 orderNum:{},",orderNum);
        return Boolean.TRUE;
    }

    @Override
    public Boolean update(Long id, String orderNum) throws Exception {
        if (id == null || id <= 0L) {
            throw new Exception("id必须大于0");
        }
        logger.info("更新订单 id:{},orderNum:{}",id, orderNum);
        return Boolean.TRUE;
    }

    @Override
    public Boolean delete(Long id) throws Exception {
        if (id == null || id <= 0L) {
            throw new Exception("id必须大于0");
        }
        logger.info("删除订单 id:{}",id);
        return Boolean.TRUE;
    }

    @Override
    public Object query(String orderNum) {
        logger.info("查询订单 orderNum:{}",orderNum);
        return "查询订单结果";
    }
}
